# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=libquotient
pkgver=0.6.11
pkgrel=0
pkgdesc="Qt5 library for cross-platform clients for Matrix"
url="https://github.com/quotient-im/libQuotient"
arch="all !armhf" # blocked by qt5-qtmultimedia
license="LGPL-2.1-or-later"
depends_dev="
	qt5-qtbase-dev
	qt5-qtmultimedia-dev
	"
makedepends="$depends_dev
	cmake
	"
subpackages="$pkgname-dev"
source="https://github.com/quotient-im/libQuotient/archive/$pkgver/libQuotient-$pkgver.tar.gz"
options="!check" # Requires a running homeserver
builddir="$srcdir/libQuotient-$pkgver"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DQuotient_ENABLE_E2EE=False # Broken
	cmake --build build
	cmake tests -B build-test
	cmake --build build-test
}

check() {
	cd build-test
	./quotest # <username> <password> quotest-travis '#quotest:matrix.org' "Alpine Linux CI"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
76a11c80822ae3279d643559b481a09fe45b1f8effb7b0efeeb7ab54f13dd06997d9220dcb36c13d270f5641f496dba350f528c49e239757f4546de9fbe940fa  libQuotient-0.6.11.tar.gz
"
